<template>
	<view class="index-box">
		<sww-search :custom-style="{ paddingBottom: '12rpx' }" @change="onSearch" keyWord="prod" historyKey="prod_search_history">
				<!-- :inactive-color="vuex_config.themeColor1" -->
			<u-tabs
				:active-color="vuex_config.themeColor1"
				:list="tabList"
				bar-width="60"
				:gutter="20"
				:current="tabAct"
				@change="tabChange"
			></u-tabs>
			<view class="prod-transform" slot="right" @click="onProdRow" v-if="!initLayout">
				<u-icon :name="prodRow ? 'e73f' : 'e742'" size="50" color="#666666" custom-prefix="iconfont"></u-icon>
			</view>
		</sww-search>
		<view>
			<prod-list v-if="!initLayout" :dataList="dataList" :layout="prodRow ? 2 : 1"></prod-list>
			<view v-else></view>
			<sww-load-more :params="dataListParams" @load="$loadMore"></sww-load-more>
		</view>
		<sww-login></sww-login>
	</view>
</template>
<script>
import { searchIndex } from './mixin/searchIndex.js';
import prodList from '@/pagecomponents/prodList/index.vue';
export default {
	mixins: [searchIndex],
	data() {
		return {
			initLayout:null,
			prodRow: false, // 布局方式
			apiName: 'GetProductList',
			classType: 1,
			parameter: {
				type: 1 // 查常规产品
			},
			title:'产品'
		};
	},
	components: { prodList },
	methods: {
		filterParameter () {
			if(this.vuex_user.level){
				this.parameter.gobal_buyer = this.vuex_user.level
			}
		},
		//切换产品排列方式
		onProdRow() {
			this.$u.debounce(
				() => {
					this.prodRow = !this.prodRow;
				},
				500,
				true
			);
		}
	}
};
</script>
<style lang="scss" scoped>
.prod-transform {
	margin-left: 16rpx;
	display: flex;
	align-items: center;
}
/*  #ifdef  MP-ALIPAY */ 
 ::v-deep  .sww-s-input {
	background-color: rgba(242, 242, 242, 0.8) !important;
}
/* #endif */

</style>
